Anti-aliased, textured, geocentric and layered fog graphics display method and apparatus

ABSTRACT

A method and apparatus in a preferred embodiment for generating anti-aliased layered fog which is textured manipulated as if in a geocentric virtual environment to thereby show horizon depression at high altitudes. Hardware is provided such that layer model data and texture model data is combined to generate fogged pixel color.

This application is a continuation of U.S. patent application Ser. No.09/812,366 filed on Mar. 20, 2001 which is a divisional of U.S. patentapplication Ser. No. 09/157,710 filed on Sep. 21, 1998.

BACKGROUND

1. The Field of the Invention

This invention relates generally to computer graphics and systems forgenerating computer graphics on a display device. More specifically, thepresent invention relates to generating anti-aliased textured andlayered fog in a geocentric environment to thereby render a moreaccurate image of the fog or similar phenomena in conjunction with theearth when viewing-an image which is representative of flight at anyaltitude, but particularly at high altitudes.

2. The State of the Art

The state of the art in rendering fog has been primarily dictated by therestraints of the coordinate system in which terrain environments arerendered. More specifically, the earth is typically rendered in avirtual environment using a flat or Cartesian coordinate system becausethe curved nature of the earth is typically not noticeable at the scaleat which most three dimensional virtual environments are rendered.However, an important exception is the case presented by flightsimulation.

The benefits of training pilots by using flight simulators are numerous.However, training is less effective when the pilots are unable to usethe same visual clues that are normally present for them in the realworld. Accordingly, the desire to provide realistic three dimensionalvirtual environments has very practical applications, only one of whichis described above.

The state of the art in three-dimensional rendering of a virtual flightenvironment has attempted to realistically render fog, where the termfog includes clouds of varying degrees of opacity. The most commonfogging function available today in an image generator (IG) and agraphic accelerator is generally referred to as homogeneous fog.Homogeneous fog derives its name from the fact that fog density isuniform in every direction from an eye position throughout the virtualenvironment. The density of the fog between an object and the eyeposition is only a function of the range between them.

FIG. 1 of the prior art shows that layered fog (also called real fog) isa non-homogenous approach to generating the fogging function. Thelayered fog algorithm provides the ability to define different densitiesfor each layer or altitude in the atmosphere. In this figure, threeseparate layers 10, 12 and 14 of fog are shown between an eye position16 and an object 18 being observed. The visibility between the eyeposition 16 and the object 18 is not only a function of the rangebetween them, but also the layers through which an eye vector (from theeye position 16 to the object 18) passes.

For every pixel that is to be rendered, an eye vector from the eyeposition 16 to a pixel must be generated. The fog contribution to thepixel must be calculated for each layer through which the eye vectorpasses on its path to the pixel, and all of these contributions must beblended into a final result.

One important visual clue to a pilot of the present altitude is that thehorizon of the earth starts to depress a few degrees at high altitudes,due to the curvature of the earth. As stated previously, the renderingfor nearly all IGs and graphic accelerators are in a Cartesian frame ofreference, not spherical. To address the need for the correct display ofa geocentric environment, polygons that are being processed (scaled,translated and rotated) in a Cartesian frame of reference have theiraltitudes (usually on the Z axis) depressed as a function of thecurvature of the planet and the range from the eye position. Thisscenario generates believable rendering as long as there is no layeredfog applied.

The state of the art in layered fog took advantage of the Cartesianenvironment by defining the layers along the Z axis of the environment.However, mixing previous layered fog implementations and a geocentricenvironment are not possible due to the layered fogs' dependency on a“flat earth” or Cartesian frame of reference.

Accordingly, what is needed is a way to provide accurate visual altitudeclues in a three dimensional and geocentric virtual environment withlayered fog.

In conjunction with a lack of altitude clues, the state of the art alsosuffers from a lack of velocity clues. State of the art layered fog doeslittle to provide visual cues for horizontal movement of the eyeposition or other objects in the virtual environment.

Accordingly, what is also needed is a way to provide accurate visualvelocity clues in a three dimensional and geocentric virtual environmentwith layered fog.

Another fundamental problem that has plagued the state of the artlayered fog systems is the aliasing that occurs between the pixels of apolygon that straddles the boundary between two or more fog layers whichhave significantly different fog layer densities. The result is that thecenter of a pixel will be determined to be within a layer with a highfog density while the center of the adjacent pixel will be determined tobe within the next layer with a low fog density. The two resultingpixels will have significantly different pixel colors, and thus aliasingwill occur. In other words, a jagged step ladder will be formed alongthe boundary between different fog layers, instead of a smooth orsmudged appearance between them. The problem grows more pronounced asthe pixels being rendered are at a great distance from the eye position(such as on the horizon), and when the pixels represent a significantlylarger physical area. This occurs when a pixel becomes larger than thethickness of the fog layer.

Accordingly, what is also needed is a way to provide anti-aliasing in athree dimensional and geocentric virtual environment having layered fog.

It is useful to understand the shortcomings of the state of the art bylooking at several patents which introduce important concepts, but failto satisfy the issues above.

In U.S. Pat. No. 5,412,796, the patent issued to Olive teaches theconcept of non-homogeneous fog. It is also noted that it is assumed thatall fog layers are parallel in a Cartesian coordinate environment, thusfailing to provide valuable altitude clues, among other things.

In U.S. Pat. No. 5,724,561, the patent issued to Tarolli et al.apparently teaches the concept of using blending to soften theboundaries between fog layers. Three registers are provided for storingcolor pixel data, a depth perspective component, and fog color data.This information is then blended using a blending unit and output by thesystem. This system differs substantially from the method and apparatusof the present invention as will be shown.

OBJECTS AND SUMMARY OF THE INVENTION

It is an object of the present invention to provide a method andapparatus for generating geocentric layered fog in a three-dimensionaland geocentric virtual environment to thereby provide visual altitudeclues.

It is another object of the present invention to provide a method andapparatus for generating textured layered fog in a three-dimensionalvirtual environment to thereby provide visual velocity clues.

It is another object of the present invention to provide a method andapparatus for generating anti-aliased layered fog in a three-dimensionalvirtual environment to thereby provide blended transitions betweenboundaries of fog layers of different densities.

It is another object to provide a method and apparatus for providinganti-aliased textured and geocentric layered fog in a three-dimensionaland geocentric virtual environment to thereby simultaneous providevisual clues for altitude and velocity while rendering blended fog layerboundaries.

It is another object to provide apparatus for generating theanti-aliased textured and geocentric layered fog which includescomputing layer model data and texture model data.

The present invention is a method and apparatus in a preferredembodiment for generating anti-aliased layered fog which is textured andmanipulated as if in a geocentric virtual environment to thereby showhorizon depression at high altitudes. Hardware is provided such thatlayer model data and texture model data is combined to generate foggedpixel color.

In a first aspect of the invention, anti-aliasing is accomplished bygenerating a plurality of sample points for each pixel, where the samplepoints are separated by approximately one screen pixel. The densities ofeach of the sample points are then blended to form an anti-aliased pixeldensity value for a rendered pixel. Some of the novel aspects includethe process of anti-aliasing the layered fog, the process of obtainingthe variables for the delta sample altitude, and the process of blendingthe sample densities together to form the final anti-aliased layered fogdensity value.

In another aspect of the invention, providing texture to the layered fogis accomplished by tracing an eye vector through all the fog layers, andthen blending the effect of each of the layers into a final blend of thefog and pixel color. At each texture layer, the X and Y components ofthe eye vector are used as indices into a texture map. The blending ofcolor and density modulation, and local and global texture effects areused to generate the appearance of a fog layer with finite thickness,not just a texture plane.

In another aspect of the invention, geocentric fog algorithms areutilized to modify the functioning of a primarily Cartesian layered fogalgorithm. Without this function, noticeable visual anomalies appear.

These and other objects, features, advantages and alternative aspects ofthe present invention will become apparent to those skilled in the artfrom a consideration of the following detailed description taken incombination with the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is an elevational profile view of an eye, three distinct layersof fog having different densities, and an object being viewed by the eyethrough all of the fog layers.

FIG. 2 is a graphical illustration of how a delta altitude between thesample points varies as a function of polygon orientation, the eyevector orientation, and the range from the eye to the pixel.

FIG. 3 is a graph of the footprint vector that is an unnormalized vectoraligned with the direction of the eye vector in the plane of thepolygon.

FIG. 4 is a graphical illustration of the footprint vector after beingscaled.

FIG. 5 is a graphical illustration of how to find the distance from thepixel to the sample using a right triangle.

FIG. 6 is a graphical illustration of textured regions and interveninguntextured general visibility regions that are processed such that theeffect of each layer is computed individually, and then attenuated byany intervening layers.

FIG. 7 illustrates one of the potential problems that can be correctlyhandled by geocentric fog layers, but not fog layers in a Cartesiancoordinate environment FIG. 8 is a graphical illustration of a layermodel that consists of altitudes for the bottom, lower, upper, and topboundaries of a cloud of fog layer.

FIG. 9A graphically illustrates a problem with the state of the art inthe simultaneous use of two different coordinate systems, where twomountain peaks, one near and one distant, lie along the same line ofsight, as displayed in their curved earth positions.

FIG. 9B graphically illustrates the scenario of FIG. 9A but in a flatearth model.

FIG. 10A graphically illustrates how in the real world, cloud layersfollow the curvature of the earth, resulting in a cloud ceiling thatwill curve down toward and eventually touch (and pass below) thehorizon.

FIG. 10B graphically illustrates how in a flat-earth layer processingspace, a cloud ceiling never reaches the horizon, and in fact becomes sooblique that all textural details must be suppressed somewhat above thehorizon.

FIG. 11 graphically illustrates that when a cloud layer lies between theeye point and the polygon, the position where the view ray intersectsthe layer is computed by similar triangles.

FIG. 12 graphically illustrates the concept of cloud clipping.

FIG. 13 is additional graphical illustration of the concept shown inFIG. 12.

FIG. 14 is a block diagram of layered fog hardware as implemented in apresently preferred embodiment in accordance with the principles of thepresent invention.

FIG. 15 is an expanded block diagram of the components of the layermodel element of the layered fog hardware of FIG. 14.

FIG. 16 is an expanded block diagram of the components of the texturemodel element of the layered fog hardware of FIG. 14.

DETAILED DESCRIPTION OF THE INVENTION

Reference will now be made to the drawings in which the various elementsof the present invention will be given numerical designations and inwhich the invention will be discussed so as to enable one skilled in theart to make and use the invention. It is to be understood that thefollowing description is only exemplary of the principles of the presentinvention, and should not be viewed as narrowing the claims whichfollow.

Before describing the presently preferred embodiment of the presentinvention, it is useful to briefly examine several limitations of stateof the art layered fog systems that have become apparent during theiruse.

First, there is a problem associated with large variations of thedensity of adjacent fog layers. Aliasing can occur when a single pixelwidth exists between two relatively different fog densities. The resultis a jagged and harsh step-like structure of the rendered image becausethe two resulting pixels will have significantly different pixel colors

The next problem is that while there is a variation of fog density withaltitude (vertical variation), there is no variation within the plane(horizontal variation) of the fog layers. Thus, if the eye positionmoves in parallel with the plane of the layered fog there is no visualcue for the speed or direction of motion in relationship to the foglayers.

Currently, many IG's simulate the appearance of patchy clouds and fogusing a semi-transparent polygon. However, this effect only works wellwhen the eye position is a great distance from the polygon. As the eyeposition nears the polygon, it become obvious that the cloud is beingmodeled by a polygon that has no depth.

Third, an important visual cue to a pilot of his altitude is that thehorizon of the earth starts to depress a few degrees at high altitudes,which is due to the curvature of the earth. The rendering for nearly allIG's and graphic accelerators are in a Cartesian frame of reference (notspherical or geocentric). To address the desire for the correct displayof a geocentric environment, polygons that are being processed (scaled,translated, and rotated) in a Cartesian frame of reference have theiraltitudes (usually on the Z axis) depressed as a function of thecurvature of the planet and the range from the eye position. Thiscreates believable rendering as long as there is no layered fog applied.Previous implementations of layered fog took advantage of the Cartesianenvironment by defining the layers along the Z axis of the environment.However, mixing a state of the art layered fog implementation and ageocentric environment are not possible due to the layered fogsdependency on a “flat earth” or Cartesian frame of reference.

The presently preferred embodiment describes a new way to solve theproblem of aliasing associated with layered fog. Aliasing artifacts willbe reduced by generating three layer model samples and blending thesamples density values together. The samples will be located over analtitude range that corresponds to approximately one pixel height inscreen space.

FIG. 2 is used to illustrate where these sample points should be and howa delta altitude between the sample points varies as a function ofpolygon orientation, the eye vector orientation, and the range from theeye to the pixel.

FIG. 2 shows that when the eye vector 20 has a primarily verticaldirection, the sample altitude 22 is primarily determined by theorientation of the polygon 24. However, as the eye vector 26 approachesa horizontal direction, the sample altitude 28 is primarily determinedby the range, and not polygon orientation.

The sample altitude 22, 28 is calculated using the pixel to eye vector(E), the polygon plane normal vector (P), the eye to pixel range (R),and the pixel size in radians (view frustum angle divided by the numberof vertical display pixels).

The first step in determining the sample altitude is to calculate a unitvector that lies in the plane of the polygon and points in the directionmost aligned with eye vector, or the eye footprint vector on the planeof the polygon. The footprint vector (F) can be calculated by firsttaking the cross-product of the eye and polygon normal vector (E×P),which is perpendicular to both the eye and polygon normal vector. Across-product is then taken of this new vector and the polygon normalvector to produce F=(P×(P×E)). This vector is the unnormalized vectoraligned with the direction of the eye vector in plane of the polygon, orthe footprint vector.

As shown in FIG. 3, renormalizing the footprint vector results in avector that has a unit length of one in the plane of the polygon. Thenormalized footprint vector is scaled by a slant factor to account forthe orientation of the plane of the polygon to the eye vector (stretchthe vector).

FIG. 4 shows that the slant factor is based on the assumption that thepixel size angle is very small, less than one degree, and that the rangebetween the pixel and the eye position will always be significantlylarger than the pixel to sample distance. These assumptions also implythat the pixel to eye vector and the sample to eye vector can be assumedto be essentially parallel.

FIG. 5 shows how the previous assumptions are used as the means to findthe distance from the pixel to the sample using a right triangle. Thehypotenuse distance can be found using the following equation:$\begin{matrix}{{Hypotenuse} = \frac{adjacent}{\cos\quad\phi}} & {{Equation}\quad 1}\end{matrix}$

The acute angle of the right triangle is equal to the angle between thepolygon normal and eye vector, thus: $\begin{matrix}{{Hypotenuse} = \frac{adjacent}{\left( {P\quad\bullet\quad E} \right)}} & {{Equation}\quad 2}\end{matrix}$

Thus, the scaling factor is the inverse function of the dot product ofthe plane vector and the eye vector.The scaled footprint vector is calculated as follows: $\begin{matrix}{{ScaledF} = \left( {{\left( \frac{F}{\left( {P\quad\bullet\quad E} \right)} \right) \cdot R \cdot \sin}\quad\theta} \right)} & {{Equation}\quad 3}\end{matrix}$

The pixel size (⊖) will always be very small (less than 1 degree). Thesine of a very small angle results in a value that is nearly the same asthe value of the angle measured in radians. In fact, for the precisionthat is required for the layered fog effect, the sine function can bedispensed with altogether and the radian value of the angle will be usedin its place. Thus equation 3 reduces to the following: $\begin{matrix}{{ScaledF} = \left( {\left( \frac{F}{\left( {P\quad\bullet\quad E} \right)} \right) \cdot R \cdot \theta} \right)} & {{Equation}\quad 4}\end{matrix}$

The Z component of the scaled foot print vector is the altitudedifference between the pixel and the sample positions. In essence,equation 4 provides a complete solution; however, all that is actuallyneeded for anti-aliasing is the Z component of the scaled footprintvector. Therefore, the process begins with equation 5 as follows:F _((unnormalized)) =P×(P×E)   Equation 5AwhereP×(P×E)=(P _(y)(P _(x)E_(y) −P _(y) E _(x))−P _(z) P _(z) E _(x) −P _(x)E _(z))),(P _(z)(P _(y) E _(z) −P _(z) E _(y))−P _(x)(P _(x) E _(y) −P _(y) E_(x))),(P _(x)(P _(z) E _(x) −P _(x) E _(z))−P _(y)(P _(y) E _(z) −P _(z) E_(y)))   Equation 5B

Because only the Z term is required, the equation is reduced to thefollowing:F _(z(unnormalized)) =P _(z)(P·E)−E _(z)   Equation 6

Applying the normalizing factor to the footprint vector produces anormalized Z component: $\begin{matrix}{F_{z{({normalized})}} = \frac{\left( {{P_{z}\left( {P\quad\bullet\quad E} \right)} - E_{z}} \right)}{\sqrt{\left( {1 - \left( {P\quad\bullet\quad E} \right)^{2}} \right)}}} & {{Equation}\quad 7}\end{matrix}$

The scaled F in the z dimension or the sample Z distance is calculatedby applying the slant factor, range, and the pixel size, which is simplythe footprint vector in the Z direction: $\begin{matrix}{{Sample}_{z} = {\left\lbrack \frac{\left( {{P_{z}\left( {P\quad\bullet\quad E} \right)} - E_{z}} \right)}{\left( {P\quad\bullet\quad E} \right)\sqrt{\left( {1 - \left( {P\quad\bullet\quad E} \right)^{2}} \right)}} \right\rbrack \cdot R \cdot \theta}} & {{Equation}\quad 8}\end{matrix}$

Unfortunately, Equation 8 still has a significant amount of complexmath. Therefore, to reduce the complexity of the design of the system,the dot product of the plane and the eye vectors will be used to indexinto a precalculated look-up table to determine the value of themodulating value M as shown in Equation 9: $\begin{matrix}{M = \frac{1.0}{\left( {P\quad\bullet\quad E} \right)\sqrt{\left( {1 - \left( {P\quad\bullet\quad E} \right)^{2}} \right)}}} & {{Equation}\quad 9}\end{matrix}$

This will reduce the sample Z calculation to a table look-up, a dotproduct, four multiplies, and one subtraction as shown in Equation 10:Sample_(z) =[M(P _(z)(P·E)−E _(z))]·R·θ  Equation 10

Unfortunately, Equation 10 fails at two points: when the eye point islooking straight-on to the polygon, and when the eye point is lookingedge-on. Because we have reduced M to a look-up table, it is possible todeal effectively with the corner cases by manipulating the contents ofthe look-up table that are produced at the corner conditions.

For the straight-on case, the length of P×E goes to zero, while themodulating factor goes to infinity. The table limits the modulatingfactor to a large but finite value; however, as the eye and plane normalapproach a horizontal value (z component goes to zero) the sample Zvalue will approach zero. In this case we know that the delta Z value ofthe unit footprint vector is simply the length of the plane-normalsprojection into the XY plane, or the square root of the sum of the planeX and Y components squared (this represents the lower limit for Z). Thisvalue is called the polygon width factor. The sample Z value will berestricted to a value greater than or equal to the polygon width factor.

A similar problem occurs when the polygon is viewed edge-on. Here thesample Z value approaches infinity. The sample Z value is limited tosome large but finite number and this value is clamped to within theminimum and maximum Z values of the polygon.

Another special case situation occurs at the horizon. As the eye vectorapproaches the horizon the sample Z value needs to approach one, so thatwe are always taking our three antialiasing samples over a span of onepixel. As the Z-component of the eye vector approaches zero, the sampleZ value is progressively forced towards one.

The actual altitudes for the three layered-fog anti-aliasing samples arethe initial pixel altitude, sample altitude plus the sample Z, and thesample altitude minus sample Z. These Z values are then bounded by theminimum and maximum altitudes of the polygon in world space coordinates.

For all three altitude samples, a density value is generated from thelayered fog density profile. These three density samples are blendedinto a single layered fog density, however, because their visual effectsare a result of the final exponentiation, and it is their visual effectsthat need to be averaged together. In general, the three densities willbe about the same; however, where they differ substantially a simpleaverage will cause the largest value to dominate and eliminate theanti-aliasing benefit of the other two. The visual effect of averagingafter exponentiating can be achieved with the following strategy: theaggregate density is determined to be the smallest value, plus limiteddeltas between the smallest and the other two values. Specifically, ifDs, Dm, and Dl represent the smallest, middle, and largest densityvalues, then: $\begin{matrix}\begin{matrix}{D_{average} = {D_{s} +}} \\{\frac{\left\lbrack {{\min\left( {0.5,{D_{m} - D_{s}}} \right)} + {\min\left( {0.5,{D_{l} - D_{s}}} \right)}} \right\rbrack}{4}}\end{matrix} & {{Equation}\quad 11}\end{matrix}$

This function results in a density value that is within about sixpercent of the averaged exponentiated results.

Along with the anti-aliasing process described above, the presentinvention also describes a new and important means of providing positionand velocity cues, and adds an important effect of realism to thelayered fog, which is well behaved if the eye position is near, far, orinside of a cloud layer.

The texture cloud model consists of multiple textured regions. Eachregion has top and bottom altitudes and visual attributes. In order tomodel the fog layers properly, a modified fog color, density delta,layer colors, and opacity modulation are calculated for each pixel. Thedensity delta is added to the antialiased density of each pixel. Bothpositive and negative values of the density delta are possible, allowingfor opacity modulation within a layer to create the effects of a thin orintermittent cloud cover.

FIG. 6 provides an example of what is going to be described hereinafter.To assure an aesthetically pleasing and technically acceptable fogeffect, the behavior of each fog layer is consistent and independent ofthe behavior of the other layers. Thus, textured regions and interveninguntextured general visibility regions are processed such that the effectof each layer is computed individually, and then attenuated by anyintervening layers.

The general visibility regions use the top and bottom colors of theadjacent textured regions for the general visibility region top andbottom colors. For example, the bottom color of a general visibilityregion is the top color of the textured region directly below it. Coloris linearly blended between the top and bottom colors of the generalvisibility region.

The calculation of the density from the eye point 30 to the pixel 32requires the combining of the effects on density and color from eachlayer. For each layer, the portion of the eye vector that lies withinthat layer is calculated and the density is determined based on thelength of the eye vector. If the eye vector completely traverses aregion from top to bottom, the density integral for the layer is thedensity sum of the top of the layer subtracted by the density sum of thebottom of the layer multiplied by the ratio of the viewray over theembedded distance. What is important to realize is that there areseveral situations which the invention must properly account forvisually. For example, the eye position and the pixel might be completedoutside of and on the same side of a cloud layer. Other situationsinclude (1) where the pixel is on the inside of a cloud layer, (2) wherethe eye position and the pixel are both within the cloud layer, (3)where the eye position is within the cloud layer and the pixel isoutside the cloud layer, (4) where the eye position is outside and on afirst side of the cloud layer, and the pixel is on the outside and anopposite side of the cloud layer.

The density for a texture layer is modulated by the texture. The textureis scaled by the opacity gain. This value is added to the layer densitysince the final effects are due to a subsequent exponentiation. Thesigned addition can have the effect of cutting the layer density tozero, or it may increase the density, making it the fog even more dense.

The results from each layer are summed into a net density delta, whichis added to the average density computed in the anti-aliased density.Also, the densities computed during the processing of the view ray aresummed. A blending factor α is computed by exponentiation. Similarly, anet fog color is computed from all the layers as shown in equation 12.{overscore (C)} _(TC)=({overscore (C)} _((TC−1))·α)+((1−α){overscore(C)} _(TF))   Equation 12

The {overscore (C)}_((TC−1)) color is the fogged color calculated forthe previous level and the {overscore (C)}_(TF) color is the fog colorfor the current layer. Using the transmittance value, the transmittedcolor for the layer is the {overscore (C)}_(TC) color. The fogged colorafter the evaluation of the last layer is the texture model color, andthe density sum of all the layers is used to generate a texture modeltransmittance value:T _(TM) =e ^(−4D)   Equation 13

Texture lookup involves computing where the eye vector intercepts thetexture layer. The texture U and V axes are aligned with the database Xand Y axes. The U and V texture coordinates are computed from the eyeposition to texture layer range (Ret), the eye position (EPos), and thenormalized eye vector (V) X & Y components: $\begin{matrix}{U = \frac{\left( {{EPos}_{x} + \left( {R_{e\quad t} \cdot E_{x}} \right)} \right)}{T_{size}}} & {{Equation}\quad 14} \\{V = \frac{\left. {{EPos}_{y} + \left( {R_{e\quad t} \cdot E_{y}} \right)} \right)}{T_{size}}} & {{Equation}\quad 15}\end{matrix}$

The Tsize is the texture cell (texel, or one pixel worth of texture)size in the data base units. The range to the texture layer is computedby scaling the eye to pixel range by the ratio of the eye to texturelayer height (Het) and the eye to pixel height(Hep). $\begin{matrix}{R_{e\quad t} = {R_{e\quad s}\left( \frac{H_{et}}{H_{ep}} \right)}} & {{Equation}\quad 16}\end{matrix}$

Having described anti-aliasing and texturing of the different foglayers, the issue of fog layers in geocentric environments will now beaddressed. The present invention is a system that provides a multilayerfog visual effect by solving an analytical atmospheric model at speed aseach scene pixel is rendered, rather than by rendering a transparentpolygonal cloud model and then viewing scene details through it. Thesystem provides greatly improved fog effects without any pixel fill-ratepenalty, and without the limitations and image quality problemsassociated with using transparent polygons.

In general, it is noted that most prior layered fog systems do not useany polygons to create the fogging effects; rather, the visual effectsof fogging are applied to the contents of a virtual environment (sky,terrain, vehicles, etc.) Fogging is a modification of existing polygonsand their pixels, and to correctly render a geocentric environmentrequires changes in how all polygons and their pixels are processed.

The layered fog model is constrained to a Cartesian frame of reference.Depressing of polygons for rendering in a geocentric environment andthen uniformly using these depressed altitudes for fogging would createnoticeable visual anomalies.

FIG. 7 illustrates one of the potential problems that can be correctlyhandled by geocentric fog layers, but not fog layers in a Cartesiancoordinate environment. As shown, a vector 40 between the eye position42 and a first object 44 can pass in and out of a fog layer 46. Thepresent invention teaches a method for modifying the functionality of aprimarily Cartesian layered fog algorithm.

When applying texture to a fog or cloud layer, a texture motif can beused to modify both the brightness and visual density of the layer. Thetexture is associated with one of two horizontal planes that are locatedsomewhat inside the layer. If the eye is above the upper texture plane,the upper plane is used; if the eye is below the lower texture plane,the lower plane is used. The user sets these two texture plane altitudesas part of the atmosphere model, and the hardware decides which plane touse based on the altitude of the eyepoint. As the eye moves from outsidethe layer towards one of these texture planes, the texture effectassociated with the plane is attenuated so that when the eye is at thesame altitude as the texture plane, no texture motif is visible. At thesame time, a “local” texture effect ramps up from nothing to full. Thislocal effect is simply the value of the texture at the lateral (x and y)position of the eyepoint, used as the instantaneous layer fog color anddensity delta, and applied to the entire scene. The visual effect whenflying entirely inside a cloud layer is a modulation of color and visualdensity that correlates with eyepoint position and velocity, andresembles “scudding”. Scudding is a term that refers to the act offlying through clouds where the view of the pilot is intermittentlywhited out when passing through a cloud. This process provides thevisual effect of a textured layer without the strong impression that thetexture is all on a single flat plane, and it allows the eyepoint to flythrough a cloud layer without the sudden and distracting penetration ofthe texture plane. In other words, if the texture is only applied to thesurface of the cloud, then the texture will be absent when flyingthrough the cloud.

FIG. 8 helps illustrate this process. The layer model consists ofaltitudes for the bottom, lower, upper, and top boundaries. If the eyeis above the upper altitude, the texture layer is scanned on thehorizontal plane at “upper”. If the eye is below the lower altitude, thetexture layer is scanned on the horizontal plane at “lower”. The blendbetween local and distant effects occurs between “top” and “upper”, orbetween “lower” and “bottom”. When the eye is between “upper” and“lower”, the distant effect is nulled out, and the entire texture effectis a full-screen scudding effect. If the eye is above “top” or below“bottom”, the entire effect is the “distant” effect, and scudding isnulled out. The blend between “distant” and “local” is linear based oneye altitude when the eye is in either blend region. No texture isapplied if the viewray from the eye doesn't intersect the texture plane.In other words, no texture is applied if the viewray is not directedtowards a textured layer, or if the viewray intersects the pixel beforeit reaches the viewray.

Accordingly, one novel aspect about the process described above is thatthe present invention uses an altitude based blend region to transitionfrom a distant to a local texture effect as the eye approaches a cloudlayer texture plane, to mask the penetration of the texture plane. Thelocal texture effect provides a realistic, spatially and temporallycorrelated scud effect.

It is important to consider the visual attributes of a cloud. Thetexture layer visual attributes include color, texel size, texelstretch, texel level-of-detail (LOD) control, brightness modulationamplitude, visual density modulation amplitude, and an illuminationdirection flag.

Still referring to FIG. 8, the top and bottom of the texture layer canhave independent colors. The color used for the layer is either the topcolor, if the eye is above “top”, or the bottom color, if the eye isbelow “bottom”, or a linear blend between them if the eye is inside thelayer, based on the eye altitude. The top and bottom of the texturelayer can have independent intensity modulation gain factors. Theintensity modulation gain used for the layer is either the top gain, ifthe eye is above “top”, or the bottom gain, if the eye is below“bottom”, or a linear blend between them if the eye is inside the layer,based on the eye altitude. The intensity modulation gain is applied tothe texture values to scale them. A value of 0 suppresses the modulationand causes the layer color to be uniform at the computed constant color,and a value of 1 provides maximum texture modulation. The texture valuesare multiplied by the modulation gain, then offset and scaled so thatmaximum modulation provides color scale factors between approximately0.125 and 1.875. This factor is then applied to the layer color,overflows are saturated, and the result used as the final layer color atthis pixel The texture layer has a visual density modulation gainfactor. This factor controls how the texture modifies the visual“thickness” of the fog in the layer. A value of 0 creates a homogeneouslayer with no “scud” effect, and the maximum value provides a fairlystrong scud effect, plus it allows the texture to cut wispy or feathered“holes” in the layer. The way in which layer visual density is modifiedmust be carefully controlled to avoid unrealistic or bizarre effects.The texture result is scaled to provide a visual density delta valuewhich ranges from approximately −1.75 to +1.75, and further attenuatedfor viewrays near the horizon by both a modulation clamp and an opacityclamp. This value is further attenuated by the existing layer visualdensity if it is less than 1. This ensures that the visual densitymodulation effect is well bounded by the actual visual density of thelayer. The final signed density delta will be applied to the overallviewray density to determine actual visibility along the entire viewray. This process allows the construction of cloud layers with wispyholes, and prevents the visual effects of one layer from interactingimproperly with those of another layer. Accordingly, it is possible tolook through several different cloud layers and see the groundintermittently when holes in the layers line up.

Therefore, one of the novel aspects of the present invention in thisregard is that the system uses texture to modify the visual density of acloud layer, where the density variation is constrained by the availablelayer density to prevent visual anomalies.

When creating the appearance of three dimensional clouds, it isimportant to note the following. First, the texture layer has texel sizeand stretch parameters, and a level-of-detail transition parameter. Thesize parameter establishes the basic “granularity” of the cloud motif atits highest or most detailed representation. The stretch value allowsthe texture motif to be stretched in either the texture U or Vdirection, to provide additional cloud motifs. The level-of-detailparameter controls how big texels appear on screen; i.e. how “busy” thecloud layer looks. LOD transitions are programmed around keeping thisconstant level of busyness.

Second, the texture layer has a parameter that says whether theillumination is coming from above or below the layer. Usually, cloudsare illuminated from above, but occasionally an overcast is illuminatedfrom below during sunrise or sunset conditions. The visual effect ofcloud illumination is to make some portions of the cloud brighter, andsome darker. If the illumination is from above the layer, and the eye isalso above the layer, then higher parts of the irregular layer top willappear bright, and lower parts or “valleys” will appear darker.Conversely, if the illumination is from above the layer but the eye isbelow the layer, then the lowest portions of the layer will appear dark,and the (inverted) valleys will appear brighter.

We simulate this effect with a two-stage texture look-up strategy. Thefirst look up computes the intercept of the view ray and the texturelayer, and uses the texture result for the visual density modulationvalue. This value is also scaled and used to lengthen or shorten theview ray by up to about a texel, at the current texture LOD. Themodified view ray is then used in a second texture look-up to get thebrightness modulation value. The same texture map is used for bothlookups, so high texel values in the map correspond to both brightercloud color and denser cloud regions, etc. The lengthened or shortenedview ray is scaled by the x and y parts of the eye-to-pixel unit normal,so the brightness motif gets shifted out or in slightly, independentlyof which direction you are looking. The illumination direction flagdetermines whether positive map values result in positive or negativemotif shifts. The shifting of bright and dark portions of the motifrelative to each other creates the impression that the surface of thecloud layer is not flat, but three-dimensional, with a roughness thatapproximates the size of the cloud-puffs.

Note that the sense of the shift also needs to be reversed depending onwhether the eye is above or below the layer. A layer that is illuminatedfrom above will have its motif shifted one way when the eye is above thelayer, and reversed when the eye goes below the layer.

Accordingly, one of the novel aspects of the present invention is thatthe 3D appearance of a cloud texture is enhanced by shifting the lightand dark portions of the texture motif based on a prior lookup of thatsame motif, combined with a way to reverse the sense of the shift basedon the direction of illumination reaching a cloud layer, and whether theeye is above or below the layer.

The present invention also provides a method and apparatus forconcatenating atmospheric cloud layers. Specifically, this aspect of theinvention relates to the computation of proper visual attributes for amulti-layer atmospheric model given the position of the observer (eyepoint) and a scene element (polygon). It includes a mechanism forapplying a cloud horizon effect that accounts for earth curvature.

A fog or cloud layer is a vertical region of the atmosphere defined bybottom and top altitudes, a color, and an opacity. Note that the opacityis the exponential of the visual density discussed above. Thus opacityis a value that ranges from 0 (clear; no fog) to 1 (totally dense; can'tsee anything.) The atmospheric model consists of some number ofnon-overlapping layers. A view ray between the eye point and a polygonpasses through any intervening layers. The color and opacitycharacteristics of a layer are computed for the portion of the layerthat the view ray passes through; the method of computation is notrelevant for this invention.

A layer between the eye and the polygon attenuates the polygon color,and adds some of the layer color. The layer opacity value (Op) is anumber between 0 (totally transparent) and 1 (totally opaque). Thecorresponding visual transmittence value (Vt) is simply (1−Op). Colorvalues (r/g/b) passing through the layer are multiplied by the layertransmittence to attenuate them. The color contributed by the layer isthe product of the layer color and opacity. The sum of these defines thenew r/g/b value that is input to further layers along the view ray:r/g/b _(out) =r/g/b _(in) *Vt _(cloud+) r/g/b _(cloud) * OP _(cloud)  Equation 17

The proper computation of the overall effect requires the layers to beapplied to the view ray in the proper sequence—beginning at the polygon,and moving to the eye point. The initial r/g/b is the polygon color, andthe terminal r/g/b is the composite color after applying atmosphericeffects.

As stated previously, the present invention utilizes a combination oftexture and general visibility layers. Typically, the atmosphere isdivided into two kinds of layers. Dense, more opaque layers form avisual substrate that can be textured, and which can function as a cloudhorizon when a curved earth approach is used. These “cloudy” layers areinterspersed with “clear” layers, corresponding to the relatively goodvisibility of the atmosphere between an overcast and a cloud deck. Onlythe dense, texturable layers are capable of functioning as an occultingcloud horizon (discussed elsewhere in this document.) Recall that layertexture transitions from a distant effect (a cloud pattern on the layer)to a local effect (an instantaneous local color) as the eye moves into atextured layer. While the horizon color is constant, it doesn't alwaysagree with the local effect, so some special processing of the horizonis required.

Recall that (for curved earth) scene details beyond the cloud horizonrange, above the dense layer that establishes the horizon, but below theslope from the eye to the horizon, are given special treatment. If theview-ray is below the horizon slope but within a pixel of it, the colorat that point along the view ray is a blend of the existing color andthe horizon layer color. If the view ray is more than a pixel below thehorizon slope, the altitude of the scene element at that pixel isdepressed enough to fully immerse the scene element in the horizonlayer. When the view ray is within a pixel of the horizon, and thespecial horizon antialias blend is active, the resulting blended colormust then be modified by the local layer color if the eye is in thehorizon layer. The special horizon color blend must be inserted into thelayer concatenation sequence ahead of the horizon layer, if the horizonlayer contains the eye.

The concatenation sequence mentioned above includes the following steps.First, the individual layer colors and opacities are computed indedicated parallel hardware. The layer concatenator must determine whatorder to apply these effects, and which layer contributions to ignore(because the view ray doesn't touch them). It does this by multiplexing(selecting) the layer data to load it into each stage of theconcatenation pipeline, and by setting the opacities to zero for layersthat aren't needed. Note that the concatenation pipeline contains astage for each layer, whether it's a texture layer or an intervening“general visibility” or “genvis” layer. It also contains an extraconcatenate stage for horizon blend, the “B” layer. Each of thesehardware stages is identical so it can deal with any of these threetypes of concatenates.

FIG. 6 is again referred to in order to illustrate this concept. Assumethe particular implementation provides an atmosphere divided into sevenlayers. Three of these are texture layers, and interspersed with (andabove and below) are four other genvis layers. These layers are numbered0 through 6, beginning with the lowest. Thus layers 0, 2, 4 and 6 aregenvis layers, and layers 1, 3 and 5 are texture layers. The eye can bein any one of these layers, and it can be looking “up” (polygon view rayintercept is higher than the eye altitude) or “down” (polygon view rayintercept is lower than the eye altitude). Note that we are dealing withaltitudes in the flat-earth layer coordinate system. Further note thatthe horizon layer can only be a texture layer, and doesn't exist if theeye is below the lowest texture layer. From the discussion of curvedearth processing, remember that we switch between bounding deck andceiling layers while we are inside a texture layer, so the switch ishidden by the thick cloud around us. Thus the horizon layer is notstrictly slaved to the eye layer. Let E be the index of the layer theeye is in (0→6 inclusive), and H be the index of the horizon layer (0→3inclusive, where 0=no horizon, 1=1, 2=3, 3=5, i.e. the three texturelayers.) The value of H switches somewhere inside each texture layer;the exact place doesn't matter here. The parameters that determine theconcatenation order are thus up/down (0/1; 0=looking down), H, and E.There are twenty different concatenation orders: u/d H E order 0 0 00,—,—,—,—,—,—,— 0 0 1 0,1,—,—,—,—,—,— 0 1 1 0,B,1,—,—,—,—,— 0 1 20,1,B,2,—,—,—,— 0 1 3 0,1,B,2,3,—,—,— 0 2 3 0,1,2,B,4,3,—,— 0 2 40,1,2,3,B,4,—,— 0 2 5 0,1,2,3,B,4,5,— 0 3 5 0,1,2,3,4,B,5,— 0 3 60,1,2,3,4,5,B,6 1 0 0 6,5,4,3,2,1,0,— 1 0 1 6,5,4,3,2,1,—,— 1 1 16,5,4,3,B,2,1,— 1 1 2 6,5,4,3,B,2,—,— 1 1 3 6,5,4,B,3,—,—,— 1 2 36,5,B,4,3,—,—,— 1 2 4 6,5,B,4,—,—,—,— 1 2 5 6,B,5,—,—,—,—,— 1 3 5B,6,5,—,—,—,—,— 1 3 6 B,6,—,—,—,—,—,—The (−) means that the opacity for that stage of the concatenator is setto zero, so that it just passes the input to the output (doesn't matterwhat the stage colors are . . . ). Note that since all concatenators areactive all the time (the nature of pipelined hardware . . . ), we cansimplify some of the multiplexing by spreading the active layers overthe 8 concatenators differently; many such optimizations are possible.

Accordingly, another one of the novel aspects of the present inventionis that cloud layer effects are concatenated in an order determined bythe relative altitudes of the eye (E) and view ray intercept, thatincludes an additional concatenation stage to apply a horizon blend. Theconcatenation is based on combining incoming and stage color based onstage opacity.

Another aspect of the invention involves earth-curvature depression ofdisplayed geometry. Specifically, image generators process geometry in athree-dimensional Cartesian coordinate system; typically the x directionis east, the y direction is north, and the z direction is “up”. Thevisual effect of a curved or spherical planet can be simulated bydepressing, or lowering, the height or z coordinate of scene vertices asa function of their distance from the observer. For distances that are asmall fraction of the planet radius, this depression value can beapproximated as a function of the square of the distance: d=k*ri, wherek=0.5/Rp, and Rp is the radius of the planet. For the earth, withcoordinates expressed in feet, k is approximately 2.4*10⁻⁸. If scenefeatures are on or near the surface of the earth, it makes littledifference whether the distance used is the horizontal range, or thetrue slant (3D) range.

As an example, a mountain peak 180 nautical miles (nm) away will bedepressed about 29,000 feet; it would be completely hidden below thehorizon for an observer on the ground. The peak is depressed about 1.5degrees of angle, or roughly the width of your thumb seen at arm'slength. Expressed another way, for a typical out-the-window displaychannel configuration, the mountain peak is depressed about 20 videoscan lines. These visual effects are very noticeable to pilots; they arealso essential to the proper simulation of ocean-going vessels.

A related effect, of particular interest to pilots, is that the positionof the horizon itself sinks below the horizontal as the aircraft flieshigher. This effect is stronger than the earth curvature alone, becausethe range to visual tangency with the earth surface is moving outwardwith increasing altitude. The range to the point of tangency, R2h, isapproximately (2*Rp*h )”, where h is the altitude above the ground, orabove an underlying cloud layer that establishes a cloud horizon. Theslope from the horizontal to the visual horizon is approximately−2*h/R2h. Note that this slope is always negative. For a specificexample, note that a pilot flying at 40,000 feet sees a visual horizonat a range of about 200 nm, depressed about 3.5 degrees down from thehorizontal. This is nearly 50 video scan lines.

Earth curvature depression is implemented in the geometry processingstage of the rendering pipeline. When it is active, the system must alsocompute a separate altitude for each vertex, to drive the layered fogprocess. Recall that layered fog operates in a flat-earth coordinatesystem, where the layers extend indefinitely in all directions atconstant heights from the Cartesian datum plane, which is typically atz=0. Proper fogging of scene details requires them to be processed inthis same flat-earth coordinate system. However, since only the z valuesdiffer between this and the curved earth system, only the additionalaltitude value is needed. This value is interpolated to obtain thealtitude where each pixel ray intercepts the surface.

A discrepancy arises in the simultaneous use of these two differentcoordinate systems, and it has unacceptable visual consequences. FIG. 9Aillustrates the problem. Two mountain peaks, one near and one distant,lie along the same line of sight, as displayed in their curved earthpositions. The distant peak is higher, but has been depressed fartherdue to its greater distance from the observer. Visually, theirjuxtaposition in the image plane properly simulates the effect of acurved earth, as FIG. 9A shows. Both peaks are obscured by a texturedcloud layer, which is processed in a flat-earth coordinate system, asFIG. 9B shows. Here, a pixel just grazing past the near peak and hittingthe distant peak actually pierces the texture layer at a very differentplace than the pixel that hits the near peak. The two pixels gettextured differently, and the visual effect is a discontinuity in thetexture motif that outlines the near peak against the distant peak, eventhough both are totally obscured.

FIG. 10A illustrates a related visual problem. In the real world, cloudlayers follow the curvature of the earth, hence a cloud ceiling willcurve down toward and eventually touch (and pass below) the horizon, asshown in FIG. 10A. Depending on the height of the overcast above theobserver, the cloud texture may never get very edge-on, and appreciabletextural detail will continue all the way to the horizon.

In our flat-earth layer processing space, however, a cloud ceiling neverreaches the horizon, and in fact becomes so oblique that all texturaldetails must be suppressed somewhat above the horizon, as shown in FIG.10B. When this is combined with earth-curvature depression of distantterrain details, a fairly wide band of untextured cloud ceiling ispresented at the horizon.

Both of these visual defects can be fixed by employing a non-lineartransformation in the texture scanning process. This transform is tiedto the geometric characteristics of the nearest cloud deck and ceilinglayers. To understand the nature of this transform, first consider theflat-earth texture scanning process.

View rays are projected from the eye point through each display pixelonto each scene polygon. These eye-to-pixel vectors are expressed in the“world” coordinate system as defined above. Actually, x and y do notneed to be aligned with the west and north compass directions; however,z must be perpendicular to the cloud layers. As the eye point movesthroughout the simulated environment, the position of the eye relativeto the texture motif of each cloud layer is computed and saved. Thisvalue, an address into the texture map, has two coordinates, u and v,which are typically synonymous with the x and y world directions,although the scale is in “cloud units” rather than “feet”, for example.When a cloud layer lies between the eye point and the polygon, theposition where the view ray intersects the layer is computed by similartriangles, as shown in FIG. 11. This intersection is relative to the eyeposition, in texel units, and is added to the eye u and v coordinates todevelop the final texel address. The texel value is then used to shadethe cloud color.

The eye-to-pixel vector is normalized to unit length for ease of use.The z component is reciprocated to create a “range ratio”. The rangeratio is “1” straight overhead, and increases towards the horizon, whereit finally goes to infinity. This value is multiplied by the heightdelta from the eye to the cloud layer, then by the x and y parts of theunit normal to compute the u and v texture address offsets. There areseveral points in this process where the scale difference between “feet”and “cloud units” can be applied. Note that the range ratio is alsoused, in conjunction with the eye-to-layer range, to compute the texturelevel-of-detail. One important result of using this formulation is thatthings which are coincident on the display are textured consistently,eliminating the texture discontinuity problem discussed above.

Now consider the scanning of a curved cloud ceiling, compared to theflat-earth version. Overhead, and for quite some distance out towardsthe horizon, the flat and curved ceilings follow quite closely. Near thehorizon, however, they diverge dramatically. The view ray continues tointersect the curved ceiling in a well-contained manner, but the rangeto intersection with the flat ceiling goes to infinity at thehorizontal, and is undefined for view rays below the horizontal. The“range ratio” derived above no longer properly defines texture behavior.For the curved ceiling, it should increase to a limiting and fairlymodest value, whereas for the flat ceiling, it quickly goes to infinity.

It is desired to scan the cloud texture motif as if it were followingthe curve of the earth. One way to do this is to compute theintersection of each view ray with the curved cloud layer. This can bedone with some fairly heavy arithmetic; however, it is only necessary tounderstand how the range to intersection changes; i.e. a new “rangeratio” is needed. To accomplish this, a transformation on the zcomponent of the eye-to-pixel unit normal is implemented, prior toreciprocating it. In effect, this transformation tips each eye-to-pixelvector just enough to cause it to intersect the flat cloud layer at thesame range as it would have intersected the curved layer.

The transform that converts z to a range ratio does most of its worknear the horizon. Its primary effect is to prevent the range ratio fromgrowing without bound. We can modify this transform as a function of theeye to ceiling height delta to provide a more accurate portrayal oftexture behavior on a curved ceiling. Note that if we are close to thecloud ceiling, even portions near the horizon are quite close, and thecurvature is still near zero. As we get farther below the ceiling, wesee more of the curved portion of the ceiling. As the aircraft movesbetween cloud layers, this transform is changed continually andgradually. However, when we climb or descend through a cloud layer, wemust make a sudden substitution of an entirely new transformcorresponding to the new ceiling value. We can do this substitutionwhile we are inside the layer, provided we require every layer to be“thick” enough visually to obscure things near the horizon, and providedwe constrain the transform to operate primarily near the horizon.

Note that a different transform can be used to “curve” the texture onthe cloud deck below the eye. It will be driven by the eye-to-deckheight delta, and will operate primarily to increase the range ratioclose to the horizon. Both of these transforms will operate on the zcomponent of the eye-to-pixel vector to generate a new z value that isthen reciprocated to get the range ratio.

For efficiency, we pick a form for the transform that can be used to doeither ceilings or decks, since any particular eye-to-pixel vector canonly hit one or the other. For cloud ceilings, i.e. “looking up”,z′=max(z,0)+fadein*max(0,t1up−t2up*abs(z))²   Equation 18

This transformation has the effect of always pushing the vector up, awayfrom the horizon and toward the cloud ceiling. Note that z′ is alwayspositive; i.e. its always headed toward the cloud ceiling, as it should.The fadein value is used to ensure that the z′ differs from z only nearthe horizon, and is simply a function that goes from 0 somewhere abovethe horizon, to 1 a little bit nearer. The absolute value operators areneeded because z can be negative for pixels that are above the eyepoint,but have been depressed appreciably. The coefficients are:t1up=0.824*(e2c/Rp)¼  Equation 19t2up=0.223*t1up/(e2c/Rp) ^(1/2)   Equation 20where e2c is the positive eye-to-ceiling height difference, and Rp isthe radius of the planet; both must be in the same units. Thesecoefficients only need to be computed at the eyepoint rate (i.e. onceper frame), and are done in general purpose hardware.

For cloud decks, i.e. “looking down”, the transform is:z′=z+max(0,t1dn−t2dn*abs(z))²   Equation 21Note that since z is negative when an observer is looking down, and weare always adding a positive offset to it, we are pushing z′ towards 0near the horizon, which increases the range ratio as required. No fadeinramp is needed with this equation. The coefficients are:t1dn=2.72*(e2d/Rp) ^(1/3)   Equation 22t2dn=3   Equation 23where e2d is the positive eye-to-deck height difference.

These transforms are approximations to the ray/ceiling intersectionarithmetic, and were developed for efficient inclusion in hardware.Other transforms could also be used.

Note that these transforms are characterized by the relationship of theeye altitude and the enclosing cloud deck and ceiling altitudes, but areapplied to all cloud/fog obscuration computations for the frame. Becausethey change things only near the horizon, global differences in foggingare masked during the transit of a layer by the eyepoint.

Accordingly, another of the novel aspect is that the present inventionapplies a transform to the length of a texture scanning vector thatcauses a horizontal plane to appear to follow the curvature of theearth. The system provides separate transforms for horizontal planesthat are above and below the eyepoint, to simulate the appearance ofcloud decks and ceilings. The transform also modifies the computation oftexture level-of-detail so it correlates with the curved visual result.Further, the nature of the transform is easily changed to account forthe relative proximity (in altitude) of the eye to the deck and ceilingplanes.

The present invention also incorporates a sort of “poor-mans”supertexture. This function addresses the problem of premature loss ofcloud texture detail in the distance, where the cloud layer isincreasingly oblique to the view ray.

Texture that is applied to scene polygons is typically managed topresent the most detailed scene that can be handled withoutobjectionable aliasing. Typically, this means using the highestresolution level-of-detail where texels are still larger than pixels.Level-of-detail determination consists of measuring the long dimensionof the pixel footprint projected onto the polygon. As this dimensionincreases, the system blends to progressively coarser (i.e. physicallylarger) texels, to ensure that adjacent pixels in the image do not skipover adjacent texels on the surface. The length of the projected pixelfootprint is proportional to the angular subtense of the pixel, therange from the eye to the surface, and the stretch factor caused bysurface “tilt” with respect to the eye. The stretch factor is the rangeto the pixel divided by the perpendicular range to the polygon. Inbrief, the projected pixel footprint=s*r²/h, where s is the pixelsubtense in radians, r is the range, and h is the “height” of the eyeabove the plane of the polygon. The footprint length is scaled intotexels to choose the appropriate level of detail.

There is a peculiar problem with this process. Texels are typicallysquare within each texture level-of-detail. When a surface isappreciably oblique to the viewer, texels which are squished to about apixel wide in their compressed direction are still many pixels wide inthe other direction. As viewed in the computed image, the texture motifis sharp in the direction of the pixel footprint, and progressively veryblurry at right angles to this direction. The visual appearance is thatthe texture detail abruptly vanishes on steeply oblique surfaces, andthat texture detail is not consistent and uniform throughout the scene.A general solution to this problem has previously been patented in U.S.Pat. No. 5,651,104 issued to Cosman and entitled Computer GraphicsSystem and Process for Adaptive Supersampling.

Layered cloud texture is somewhat different. In general, cloud layersare not visually “busy”, nor are they particularly “specific.” It isneither desirable nor economic to provide and process large, complexcloud texture motifs. Very realistic scenes can be created with smallgeneric texture motifs, and with texture level-of-detail transitionsthat occur well before cloud texels become pixel-limited. In fact, byforcing texture LOD to happen when cloud texels are still quite large,the associated processing hardware can be substantially reduced. Thisstrategy also allows a modified level-of-detail transition process thatprovides more uniform texture detail, and avoids the suddendisappearance of textural detail in the distance.

First, we will use the range ratio that comes from the z′ value. Thismatches the texture level of detail to the curved layer geometry, ratherthan the flat-earth case, and allows textural detail to follow the cloudceiling all the way to the horizon, as it does in the real world. Notethat the range ratio continues to increase towards the horizon, but the“obliqueness” of the cloud ceiling reaches a limiting value, which isapproximately 2/t1up. For texture LOD determination, we will limit therange ratio to this value. Next, we will separate the range and slantparts of the pixel footprint processing and treat them differently:

-   -   s=pixel subtense in radians    -   A=range ratio or aspect ratio limit,=R/h, nominally, or 1/z,        limited to 2/t1up    -   R=range to cloud texture plane in database units,=(range        ratio)*(eye to texture height delta)    -   t=texel size in radians where LOD transitions, should be much        larger than s . . .    -   T=texel size in database units    -   M=required texture level-of-detail, 1=highest, 2=next, etc.        First, the standard formulation:        pps=s*R ² /h=s*R*A   Equation 24        M=pps/T=R/T*s*A   Equation 25        Now the supertexture twist:        M=t*R/T*A*s/t   Equation26        (multiply, then divide by t)    -   M=t*R/T*max(1,(A*s/t)   Equation 27        At this point some comments are in order. First, note that R/T        is the reciprocal of the instantaneous texel subtense in        radians. If we are looking straight up or down, A=1, and M is        entirely determined by the first half of the equation. In this        case, t*R/T produces a dimensionless value where 1 indicates        that texels now appear the size they are when the LOD transition        should begin, and values greater than 1 take us through the        lower LOD's. Now consider what happens when the first term is        just at the threshold of forcing the first LOD transition (=1).        In this case, the long dimension of a texel just subtends t        radians; remember that it is still much larger than a pixel. The        ratio s/t is always less than 1, so the value of A can become        much larger than 1 before this term starts affecting the        displayed LOD. This term allows texels to become oblique to        where the compressed dimension of the texel is pixel size (s        rather than t) before forcing an LOD transition. The max        operator on the second half of the equation is necessary to keep        the range and slant parts of the function properly separated.        The overall effect of the equation is to ensure that the        selected texel size is larger than t in its uncompressed        direction, and larger than s in its compressed direction.

Accordingly, another point of novelty of the present invention is thatit computes texture level of detail by separating the range and slantparts of the process, and applying separate limits to each portion. Theprocess allows texture LOD to be based on a combination of theperspective size of the texel in either its visually compressed oruncompressed directions, and hence provides better homogeneity oftextural detail for oblique surfaces.

Another important issue is that of a cloud layer “Horizon Clip.” Cloudlayer decks present another problem. The curved layer establishes anominal horizon line whose angle below the horizontal, and range topoint of tangency, are defined by the height of the eye above the layer.Scene details above the layer but farther than the horizon range andbelow the angle of tangency should be occulted by the layer. Theboundary where this occlusion takes place needs to be antialiased so the“clip” line doesn't crawl. FIGS. 12 and 13 illustrate the strategychosen; the discussion assumes the scene detail is above the cloud layerand beyond the horizon range.

First, note that a view ray whose slope (z component of the eye-to-pixelunit normal) is just higher than the horizon slope should not beaffected by the layer (FIG. 12). Second, a view ray just below thehorizon slope should be fogged as if it were totally occluded by thelayer. In this case, the color of the scene detail should be replaced bythe color of the layer at the horizon, which is conveniently where alltextural detail has been mipped out. Since the horizon color is constantright at the horizon line, we establish a one-pixel wide region at thehorizon where we perform a linear blend between the polygon color andthe constant horizon color. This effectively antialiases the clipboundary.

Below this blend region, we must “sink” the scene detail below the layerto ensure that it gets occulted. We do this by further depressing itsaltitude, but not changing the associated range ratio, which must remaintied to the z′ value to ensure texture motif consistency, as shown inFIG. 13. Note that for a view ray just at the horizon, we want depressit an amount that makes it intersect the cloud deck at the horizonrange. As view rays descend farther below the horizon, we relax thedepression function so that the effect stays focused near the horizon,and scene details appreciably below the horizon are not modified. Notethat there is a small slope-delta limit to the amount that a scenedetail can be above the layer but below the horizon slope—typicallyabout 0.125, or about 7 degrees, based on maximum visibility ranges ofseveral hundred miles and maximum flight altitudes of about 60,000 feet.

A polygon that exists both above and below the layer altitude, and bothin front of and behind the horizon range, will show a sharpdiscontinuity at the horizon range where the horizon occultation processkicks in. We prevent this by ramping the horizon blend in gradually,beginning somewhat closer than the horizon range. Finally, if the eye isjust barely descending into the deck layer, but the pixel is above thehorizon, we need to modify the view ray to account for the fact that itis grazing the top of the layer. We do this by forcing a short portionof it, beginning at the eye, to be horizontal so that a little bit moreof the layer top gets applied to the pixel.

Accordingly, another novel of the present invention is that it providesthe visual effect of a cloud deck on a curved earth properly occultingscene details that lie above the altitude of the cloud layer, but beyondthe cloud horizon range, and below the eye-to-horizon slope. The systemuses a pixel-level blend to antialias the nominal horizon, and depressesthe altitude of scene details that should be occulted, on a pixel bypixel basis, to hide them beneath the cloud deck. It further applies ablend into this effect based on the relative range of scene details andthe cloud horizon, to prevent visual anomalies for scene details at thehorizon range.

FIG. 14 is provided as a preferred embodiment of a layered fog hardwareblock implementation. A layered fog means is provided pixel informationfrom the rasterization of polygons and the pixel-rate illumination whichis performed in each of the pixels produced by the rasterization. Thealtitude of a pixel is a result of interpolating the altitudes from thevertices of each polygon that is rasterized. For each pixel that isgenerated for a polygon, an illumination algorithm is applied (such asphong shading) and the pixel range and the eye-to-pixel viewray areproducts of this illumination algorithm.

FIG. 14 shows two main elements of the layered fog hardware. Theseelements are the layer model 50 and the texture model 52. Both the layermodel 50 and the texture model 52 receive as inputs the eye to pixelrange 54, the eye to pixel viewray 56, and the eye altitude 58. However,the layer model 50 also receives the pixel altitude 60 as input.

The texture model 52 receives as input the output 64 of the layer model50, and the unfogged pixel color 66. The output of the texture model 62is the fogged pixel color 70.

FIG. 15 is a block diagram showing a break down of the functionalcomponents within the layer model 50. The functional components whichreceive as inputs all of the inputs 54, 56, 58 common to the layer model50 and the texture model 52 include an altitude depression module 72, atop density generator 74, a middle density generator 76, a bottomdensity generator 78, and an eye to horizon density module 80.

The altitude depression model 72 has two outputs. A first output 82 iscoupled to the output 64 of the layer module 50. A second output 84functions as an input to a three sample altitude generator 86. An output88 of the three sample altitude generator 86 is the only input to adensity profile change-point selection module 90. This module in turnprovides input to the top density generator module 74, the middlegensity generator 76, and the bottom density generator 78.

A first output 92 of the top density generator 74 is an input to thelayer model output 64. A second output 94 is an input to a densityaverage module 102. The middle density generator 76 also has a firstoutput 96 which is coupled to the layer model output 64, and a secondoutput which is an input to the density average module 102.

The bottom density generator has only a single output 100 which iscoupled to the density average module 102. The density average modulereceives an input from the eye to horizon density model 80, and has anoutput signal 104 which is also coupled to the layer model output 64.

Finally, the eye to horizon density module 80 has a second output 108which is coupled to the layer model output 64, and a third output 110which is an input signal to the top density generator 74, the middledensity generator 76, and the bottom density generator 78.

As a brief description of the modules, the altitude depression moduledetermines the relationship of the pixel position, eye position, and thehorizon. From this information a depressed altitude and blend factor aregenerated for use by other modules in the system.

The three sample generator 86 creates three anti-aliasing samplealtitudes near the pixel altitude based on the viewray and the polygonorientation.

The density profile change-point selection module 90 compares each ofthe anti-aliasing samples against the density profile, and theappropriate change-point is selected for use in the density generators.

The top, middle and bottom density generators 74, 76 and 78 determinethe vertical density between the eye altitude and the sample altitude,then based on the range and viewray, the density between the eye andpixel position is determined.

The eye to horizon density block determines the interaction of theviewray and horizon, and calculates a density offset which is used bythe density averaging module 102 and the texture model 52.

The density average module 102 blends the three sample densities into afinal pixel density value.

FIG. 16 is a block diagram showing a break down of the functionalcomponents within the texture model 52. The functional component whichreceives as inputs all of the inputs 54, 56, 58 common to the layermodel 50 and the texture model 52 is a texture setup module 120. Thismodule 120 also receives as input the layer model output 64.

The texture setup module 120 sends out seven output signals, one signalfor each of the texture layer modules 136, 138 and 140, and one signalfor each of the general visibility modules 142, 144, 146 and 148. Eachtexture layer module and general visibility module also has a singleoutput signal which is transmitted to a layer concatenation module 150.The layer concatenation module also receives as input the unfogged pixelcolor signal 66, and generates the fogged pixel color output signal 70.

The texture setup module 120 calculates common data required by thegeneral visibility and etxture layers and initiates the evaluation ofthe seven defined layers for a pixel.

The general visibility layers determine the amount of fog density on theportion of the viewray that intersects through these low density fogregions.

The texture layers apply the texture data to the color and density ofthe fog to that portion of the view ray that intersects through thesehigh-density fog regions.

Finally, the layer concatenation module 150 collects the results of thegeneral visibility and the texture layers and concatenates the resultsinto a final fog transmittance and fog color. The transmittance value isused to blend between the final fog color and the unfogged pixel color.

It is to be understood that the above-described arrangements are onlyillustrative of the application of the principles of the presentinvention. Numerous modifications and alternative arrangements may bedevised by those skilled in the art without departing from the spiritand scope of the present invention. The appended claims are intended tocover such modifications and arrangements.

1. A method for simulating the effects of layered fog in acomputer-generated synthetic environment, wherein aliasing is eliminatedat a boundary between regions of the layered fog that have differentdensities, and wherein the boundary of the regions of the layered foglies between adjacent pixels, said method comprising the steps of: (1)generating a plurality of sample points for each of the adjacent pixelsthat lie on the boundary of the layered fog regions; (2) calculating alayered fog density for each of the plurality of sample points; and (3)blending the layered fog density that is calculated for each of theplurality of sample points to thereby form an anti-aliased pixel layeredfog density value for each of the adjacent pixels.
 2. The method asdefined in claim 1 wherein the method further comprises the step ofutilizing a total of three sample points to represent the plurality ofsample points selected from within each of the adjacent pixels that lieon the boundary of the layered fog regions.
 3. The method as defined inclaim 1 wherein the method of selecting the adjacent pixels that lie onthe boundary of the layered fog regions further comprises the step ofselecting pixels that are separated by a distance of approximately onescreen pixel.
 4. The method as defined in claim 2 wherein the methodfurther comprises the step of selecting the plurality of sample pointsover an altitude range that corresponds to approximately one pixelheight in display screen space.
 5. The method as defined in claim 4wherein the method further comprises the step of determining a samplealtitude for each of the plurality of sample points.
 6. The method asdefined in claim 5 wherein the method further comprises the step ofdetermining a Z component of a scaled eye footprint vector for each ofthe plurality of sample points.
 7. The method as defined in claim 6wherein the step of determining the sample altitude further comprisesthe steps of: (1) determining a length of an eye vector; (2) determininga slope of an eye vector; (3) determining an orientation of a polygonfor which the sample altitude value is being calculated; and (4)determining a total number of pixels on a computer display.
 8. Themethod as defined in claim 7 wherein the method further comprises thestep of determining whether the eye vector has a primarily verticaldirection or a primarily horizontal direction.
 9. The method as definedin claim 8 wherein the method further comprises the steps of: (1)determining the sample altitude primarily as a function of anorientation of the polygon when the eye vector has a primarily verticaldirection; and (2) determining the sample altitude primarily as afunction of a range of the polygon when the eye vector has a primarilyhorizontal direction.
 10. The method as defined in claim 9 wherein thestep of determining the sample altitude further comprises the steps of:(1) determining a pixel to eye vector (E); (2) determining a polygonplane normal vector (P); (3) determining the eye to pixel range (R); and(4) determining a pixel size in radians;
 11. The method as defined inclaim 10 wherein the step of determining a pixel size in radians furthercomprises the step of dividing a view frustum angle by a total number ofvertical display pixels on the display screen.
 12. The method as definedin claim 1I wherein the method further comprises the step of calculatinga unit vector that lies in a plane of the polygon, and which points in adirection that is most aligned with (1) the eye vector, or (2) an eyefootprint vector (F) on the plane of the polygon.
 13. The method asdefined in claim 12 wherein the method further comprises the step ofcalculating the eye footprint vector (F).
 14. The method as defined inclaim 13 wherein the step of calculating the eye footprint vector (F)further comprises the steps of: (1) calculating a new vector by taking across-product of the pixel to eye vector (E) and the polygon planenormal vector (P), wherein the eye footprint vector (F) is perpendicularto both the pixel to eye vector (E) and the polygon plane normal vector(P); and (2) calculating a cross-product of the new vector and thepolygon plane normal vector (P) to obtain the eye footprint vector (F)which is an unnormalized vector aligned in a direction of the pixel toeye vector (E) in the plane of the polygon.
 15. The method as defined inclaim 14 wherein the method further comprises the step of renormalizingthe eye footprint vector (F), wherein renormalizing generates arenormalized eye footprint vector that has a unit length of one in theplane of the polygon.
 16. The method as defined in claim 15 wherein themethod further comprises the step of scaling the renormalized eyefootprint vector (F) by a slant factor to thereby obtain a scaled eyefootprint vector that accounts for an orientation of the plane of thepolygon relative to the eye footprint vector, wherein the slant factoris generated based on an assumption that an angle between the pixel toeye vector (E) and each of the plurality of sample points is less thanone degree, that the eye to pixel range (R) will always be substantiallylarger than a pixel to sample distance, and that the pixel to eye vector(E) and a sample to eye vector are substantially parallel.
 17. Themethod as defined in claim 16 wherein the method further comprises thestep of calculating the scaled eye footprint vector using a formula:${ScaledF} = \left( {{\left( \frac{F}{\left( {P \cdot E} \right)} \right) \cdot R \cdot \sin}\quad\theta} \right)$18. The method as defined in claim 17 wherein the method furthercomprises the step of simplifying the equation of claim 17 by discardingthe sin θ term because a sine of a small angle is nearly a value of theangle measured in radians, thereby simplifying the formula to:${ScaledF} = \left( {\left( \frac{F}{\left( {P \cdot E} \right)} \right) \cdot R \cdot \quad\theta} \right)$19. The method as defined in claim 18 wherein the step of calculatingthe Z component of the scaled eye footprint vector for each of theplurality of sample points further comprises the step of applying theslant factor, the eye to pixel range (R), and the pixel size using aformula:${Sample}_{z} = {\left\lbrack \frac{\left( {{P_{z}\left( {P \cdot E} \right)} - E_{z}} \right)}{\left( {P \cdot E} \right)\sqrt{\left( {1 - \left( {P \cdot E} \right)^{2}} \right)}} \right\rbrack \cdot R \cdot \theta}$20. The method as defined in claim 19 wherein the method furthercomprises the step of reducing complexity of the formula in claim 19 byusing a dot product of the polygon plane normal vector and the pixel toeye vector to thereby index into a precalculated look-up table todetermine a modulating value M, thus resulting in the step ofcalculating the Z component of the scaled eye footprint vector for eachof the plurality of sample points as a formula:Sample=[M(P _(z)(P·E)−E _(z))·R θ
 21. The method as defined in claim 20wherein the method further comprises the step of modifying the formulaof claim 20 when: (1) an eyepoint is observing the polygon straight-onto the polygon such that (P·E)=1, where the length of the pixel to eyevector goes to zero, while the modulating factor M goes to infinity; and(2) the eyepoint is observing the polygon edge-on such that (P·E)=0,where the sample Z value approaches infinity.
 22. The method as definedin claim 21 wherein the method further comprises the step ofmanipulating contents of the look-up table that are generated at acorner condition.
 23. The method as defined in claim 21 wherein themethod further comprises the step of making an adjustment in the sampleZ value when the pixel to eye vector (E) approaches the horizon, whereinthe sample Z value needs to approach one so that the plurality ofantialiasing samples are over a span of one pixel.
 24. The method asdefined in claim 2 wherein the method further comprises the step ofselecting as the three sample points (1) an initial pixel altitude, (2)the initial pixel altitude plus the sample altitude, and (3) the initialpixel altitude minus the sample altitude.
 25. The method as defined inclaim 24 wherein the method further comprises the step of bounding theinitial pixel altitude plus the sample altitude and the initial pixelaltitude minus the sample altitude by a minimum and a maximum altitudesof the polygon in world space coordinates.
 26. The method as defined inclaim 25 wherein the method further comprises the step of obtaining anantialiased layered fog effect wherein a fog density value of the threesample altitudes is blended into a single layered fog density, whereinthe single layered fog density is obtained by averaging afterexponentiating each of the three sample altitudes.
 27. The method asdefined in claim 26 wherein the method further comprises the steps of:(1) selecting as an aggregate density a smallest density value of thethree sample altitudes; and (2) utilizing the aggregate density tothereby calculate a function that is a density value that is withinapproximately six percent of an averaged exponentiated result, andwherein the function is represented by a formula:$D_{average} = {D_{s} + \frac{\left\lbrack {{\min\quad\left( {0.5,{D_{m} - D_{s}}} \right)} + {\min\quad\left( {0.5,{D_{l} - D_{s}}} \right)}} \right\rbrack}{4}}$